package com.ymatou.iapi.productmanager.service;

import com.google.common.reflect.TypeToken;
import com.ymatou.iapi.productmanager.parameter.SaleCommissionKvDto;
import com.ymt.base.YmatouBaseCall;
import com.ymt.core.tool.FormatUtil;
import com.ymttest.utils.EnvSetup;

import java.util.List;

/**
*批量查询商品销售佣金Call
*FreeMaker Template自动生成代码
*/
public class QueryCatalogCommissionsCall extends YmatouBaseCall{
	private static String opurl ="api/SellerProduct/QueryCatalogCommissions";
	
	public QueryCatalogCommissionsCall() {
		super(EnvSetup.getSystemUrl("productmanager"),opurl,"POST","JSON");
	}
	@Override
	public void addDefHeader() {
		client.addHeader("Accept","text/xml,text/javascript,text/html,application/json");
		client.addHeader("Content-Type", "application/json; charset=UTF-8");
	}
	public List<SaleCommissionKvDto> getCommissionList(){
		String CommissionLog=getJsonObject().get("Data").getAsJsonObject().get("CommissionList").getAsJsonArray().toString();
		List<SaleCommissionKvDto> CommissionList=(List<SaleCommissionKvDto>) FormatUtil.GSONToObject(CommissionLog, new TypeToken<List<SaleCommissionKvDto>>(){}.getType());
		return CommissionList;
	}
}